# -*- coding:utf-8 -*-

from rest_framework.viewsets import ModelViewSet
from rest_framework.views import APIView
from Apps.System.filters.loginInfoFilter import SystemUserLoginInfoFilter
from Apps.System.models.loginLog import SystemUserLoginInfo
from Apps.System.ser.loginLogSer import LoginInfoSer
from Apps.common.response import SuccessResponse
import logging

logger = logging.getLogger("django")


class LoginInfoView(ModelViewSet):
    queryset = SystemUserLoginInfo.objects.all()
    serializer_class = LoginInfoSer
    filter_class = SystemUserLoginInfoFilter


class LoginLogDeleteView(APIView):
    queryset = SystemUserLoginInfo.objects.all()

    def post(self, request, *args, **kwargs):
        self.queryset.filter(id__in=request.data.get("ids")).delete()
        logger.info(request.data.get("ids"))
        return SuccessResponse("1")
